public class Solution509 {
    public int fib(int n) {
        if (n==0||n==1){
            return n==0?0:1;
        }else{
            int a=0,b=1;
            for (int i=2;i<=n;i++){
                int c=a+b;
                a=b;
                b=c;
            }
            return b;
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution509().fib(2));
    }
}
